cat << EOF > ${tmpworkdir}/_install.sh
#!/bin/bash

set -e

exec &> >(tee -a /tmp/install.log)

cd \$(dirname \$0)
echo "running install"
echo "HOME: \${HOME}"

useradd -M -U -G dialout,sudo -u ${userid} -d /home/${username} -s /bin/bash ${username}
echo ${username} ALL=NOPASSWD: ALL > /etc/sudoers.d/${username}

apt update

./common/timezone.sh
./common/enable_ssh.sh

./common/ubuntu_unminimize.sh || true

./common/install_monitor.sh
./common/install_autotools.sh || true
./common/install_filetools.sh
./common/install_devtools.sh
./common/install_dbg_kernel.sh
./common/install_dbg_user.sh

./common/pip_setup.sh
./common/install_devwheels.sh

./common/install_java.sh

# ./common/gitsetup.sh
# ./common/install_mdtools.sh
# ./common/install_fstools.sh
# ./common/install_disktools.sh
# ./common/install_nettools.sh

# Clean apt cache at the end
./common/clean_apt.sh
./common/debian_login_setup.sh || true
EOF

